home *** CD-ROM | disk | FTP | other *** search
- /*
- * Copyright (C) 1994, Silicon Graphics, Inc.
- * All Rights Reserved.
- *
- * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
- * the contents of this file may not be disclosed to third parties, copied or
- * duplicated in any form, in whole or in part, without the prior written
- * permission of Silicon Graphics, Inc.
- *
- * RESTRICTED RIGHTS LEGEND:
- * Use, duplication or disclosure by the Government is subject to restrictions
- * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
- * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
- * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
- * rights reserved under the Copyright Laws of the United States.
- */
- #include <stdlib.h>
- #include <limits.h>
- #include <stdio.h>
- #include "pref.h"
-
- Pref::Pref(const char *name) : VkPrefDialog (name)
- {
- prefAccuracy = new VkPrefText("accuracy");
- prefAccuracy->setValue("20");
- setAccuracy(20);
-
- prefDelay = new VkPrefText("delay");
- prefDelay->setValue("1");
- setDelay(1);
-
- prefFrames = new VkPrefText("frames");
- prefFrames->setValue("300");
- setFrames(300);
-
- prefCount = new VkPrefText("count");
- prefCount->setValue("10");
- setTripCount(10);
-
- prefType = new VkPrefToggle("motion");
- prefType->setValue(TRUE);
- setTripType(MOTION);
-
- _group = new VkPrefGroup("group",FALSE,FALSE);
- _group->addItem(prefAccuracy);
- _group->addItem(prefDelay);
- _group->addItem(prefFrames);
- _group->addItem(prefType);
- _group->addItem(prefCount);
- setItem(_group);
-
- }
-
- Pref::~Pref()
- {
- delete prefAccuracy;
- delete prefDelay;
- delete prefFrames;
- delete prefCount;
- delete prefType;
- delete _group;
- }
-
- void Pref::update()
- {
- if(prefAccuracy->changed()){
- int acc = atoi(prefAccuracy->getValue());
- if(acc == LONG_MAX || acc <= 0){
- acc = 20;
- prefAccuracy->setValue("20");
- }
- setAccuracy(acc);
- }
- if(prefDelay->changed()){
- int delay = atoi(prefDelay->getValue());
- if(delay == LONG_MAX || delay <= 0){
- delay = 1;
- prefDelay->setValue("1");
- }
- setDelay(delay);
- }
- if(prefFrames->changed()){
- int frames = atoi(prefFrames->getValue());
- if((frames == LONG_MAX || frames <= 0) && (frames != -1)){
- frames = 300;
- prefFrames->setValue("300");
- }
- setFrames(frames);
- }
- if(prefCount->changed()){
- int count = atoi(prefCount->getValue());
- if(count == LONG_MAX || count <= 0){
- count = 10;
- prefCount->setValue("10");
- }
- setTripCount(count);
- }
- if(prefType->changed()){
- if(prefType->getValue()){
- setTripType(MOTION);
- }else{
- setTripType(STATIC);
- }
- }
- }
-